﻿<script id="messagesTmpl" type="text/x-jquery-tmpl">
<div class="messages" anchor="new"{{if has_next}} has_next="true"{{/if}}{{if has_prev}} has_prev="true"{{/if}}>
  {{tmpl(messages, { targetBlank: targetBlank, hideCheckboxes: hideCheckboxes, showFolders: showFolders, htmlEncode : $item.htmlEncode, getTagsToDisplay: $item.getTagsToDisplay, getCountTagsInMore: $item.getCountTagsInMore}) "messageItemTmpl"}}
</div>
</script>

<script id="messageItemTmpl" type="text/x-jquery-tmpl">
    <div style="-ms-grid-row: ${index}" data_id="${id}" date="${date}" chain_date="${chainDate}" class="row{{if isNew}} new{{/if}}" {{if restoreFolderId}} PrevFolderId="${restoreFolderId}" {{/if}}>
        {{if !$item.hideCheckboxes }}
        <div class="checkbox">
            <input type="checkbox" data_id="${id}" title="${ASC.Mail.Resources.MailResource.Select}" />
        </div>
        {{/if}}
        <div class="importance">
            <i class="icon-{{if important!=true}}un{{/if}}important"
               title="{{if important}}${ASC.Mail.Resources.MailScriptResource.ImportantLabel}{{else}}${ASC.Mail.Resources.MailScriptResource.NotImportantLabel}{{/if}}"></i>
        </div>
        <div class="from">
            <a href="${anchor}" {{if $item.targetBlank}} target="_blank" {{/if}}>
                <span class="author" title="${author!='' ? author : sender}" email="${sender}">
                    {{if author=='' && sender==''}}${ASC.Mail.Resources.MailResource.NoAddress}{{else}}${author!='' ? author : sender}{{/if}}
                </span>
                <span class="chain-counter" value="${chainLength}">{{if chainLength > 1}}(${chainLength}){{/if}}</span>
            </a>
        </div>
        <div class="subject" title="{{if subject==''}}${ASC.Mail.Resources.MailResource.NoSubject}{{else}}${$item.htmlEncode(subject)}{{/if}}">
            <a href="${anchor}" _tags="{{each tagIds}}{{if $index>0}},{{/if}}${$value}{{/each}}" {{if $item.targetBlank}} target="_blank" {{/if}}>
                {{tmpl($item.getTagsToDisplay(tags), { htmlEncode : $item.htmlEncode}) "messageItemTagsTmpl"}}
                {{tmpl($item.getCountTagsInMore(tags)) "messageItemTagsMoreTmpl"}}
                <span class="subject-text">{{if subject==''}}${ASC.Mail.Resources.MailResource.NoSubject}{{else}}${$item.htmlEncode(subject)}{{/if}}</span>
            </a>
        </div>
        {{if $item.showFolders}}
        <div class="folder">
            <a href="${anchor}" {{if $item.targetBlank}} target="_blank" {{/if}}>${folderName}</a>
        </div>
        {{/if}}

        <div class="readReq">
            <a href="${anchor}" {{if $item.targetBlank}} target="_blank" {{/if}}>
                {{if readRequestStatus==true && folder==1}}
                <svg class="readReq-svg" width="16" height="16">
                    <use base="/" href="/skins/default/images/svg/mail-icons.svg#mailRequestRead" />
                </svg>{{/if}}
            </a>
        </div>

        <div class="attachment">
            <a href="${anchor}" 
               {{if $item.targetBlank}} target="_blank" 
               {{/if}}>
            {{if hasAttachments==true}}
            <i class=
               "{{if calendarUid != null && calendarUid != ''}}
               icon-calendar
               {{else}}
               icon-attachment
               {{/if}}">
                </i>
            {{/if}}</a>
        </div>

        <div class="date">
            <a href="${anchor}" {{if $item.targetBlank}} target="_blank" {{/if}}>{{if isToday}}${ASC.Mail.Resources.MailResource.TodayLabel}{{else isYesterday}}${ASC.Mail.Resources.MailResource.YesterdayLabel}{{else}}${displayDate}{{/if}}</a>
        </div>
        <div class="time">
            <a href="${anchor}" {{if $item.targetBlank}} target="_blank" {{/if}}>${displayTime}</a>
        </div>
    </div>
</script>

<script id="messageItemTagsTmpl" type="text/x-jquery-tmpl">
  <span labelid="${id}" class="tag tagArrow tag${style}" title="${$item.htmlEncode(name)}">
      <p class="messages-tags">${$item.htmlEncode(short_name)}</p></span>
</script>

<script id="messageItemTagsMoreTmpl" type="text/x-jquery-tmpl">
  {{if $data > 0}}<span class="more-tags link dotted">${ASC.Mail.Resources.MailScriptResource.More.replace('%1', $data)}</span>{{/if}}
</script>